<!-- 已录入 -->
<template>
  <div class="box">
    <section class="section_wrap">
      <FunctionalAreas></FunctionalAreas>
      <div class="title_sub prduct_bod_r">产品说明：</div>
      <ProductDescription></ProductDescription>
    </section>

    <section class="section_wrap">
      <div class="title_sub infro_bod_l">信息查看：</div>
      <div class="state">状态：已录入</div>
      <EnterInfor></EnterInfor>
    </section>

    <section class="section_three">
      <div class="title_sub upload_bod_l">附件管理：</div>
      <Upload class="uploadStyle" ref="Uploade" :isNew="isNew"></Upload>
    </section>
    <section class="section_wrap">
      <el-button
        v-if="commintBtn"
        type="primary"
        class="primaryButton"
        @click="primaryButton"
        >提交审批</el-button
      >
      <div class="title_sub infro_bod_l">操作记录：</div>
      <OperationRecords :orderNumber="orderNumber"></OperationRecords>
    </section>
  </div>
</template>

<script>
import { putOrderCommit, getProductUrl } from "../../../src/assets/js/api";
import { checkPermiss } from "../../assets/js/utlis";
import FunctionalAreas from "../../components/fapai/FunctionalAreas";
import EnterInfor from "../../components/fapai/EnterInfor";
import Upload from "../../components/fapai/Upload";
import OperationRecords from "../../components/business/OperationRecords";
import ProductDescription from "../../components/business/ProductDescription";
export default {
  data() {
    return {
      isNew: false,
      orderNumber: "",
      ProductUrl: "",
      //权限
      golbalPermissions: [],
    };
  },
  components: {
    ProductDescription,
    EnterInfor,
    Upload,
    OperationRecords,
    FunctionalAreas,
  },
  computed: {
    //提交审批按钮
    commintBtn: function () {
      return checkPermiss("business:auction:commit", this.golbalPermissions);
    },
  },
  created() {
    this.orderNumber = sessionStorage.getItem("orderNumber");
    this.golbalPermissions = localStorage.getItem("permissions").split(",");
  },
  mounted() {
    this.getProductUrl();
  },
  methods: {
    //根据orderNumber判断跳转的产品路径
    getProductUrl() {
      getProductUrl({ orderNumber: this.orderNumber }).then((res) => {
        this.ProductUrl = res.data.productUrl;
      });
    },
    //提交审批按钮
    primaryButton() {
      //验证审批的身份证图片
      let uploadImg = this.$refs.Uploade.fileList;
      if (!uploadImg.length >= 1) {
        this.$message({
          message: "请上传身份证件照",
          type: "error",
        });
      } else {
        putOrderCommit(this.orderNumber).then((res) => {
          this.$message({
            message: res.message,
            type: "success",
          });
          this.$router.replace({ path: this.ProductUrl });
        });
      }
    },
  },
};
</script>
<style lang="less" scoped>
.state {
  font-size: 22px;
  font-weight: bold;
  float: right;
  margin-top: -30px;
  margin-right: 3%;
}
</style>
